import {createRouter, createWebHashHistory} from 'vue-router'
import NProgress from "nprogress";
import 'nprogress/nprogress.css'
import Home from '@/views/Home.vue'
import Login from '@/views/Login.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {path: '/', name: 'home', component: () => import('@/views/basic/List.vue')},
    {path: '/login', name: 'login', component: Login},
    // {path: '/basic', name: 'basic', component: () => import('@/views/basic/List.vue')},
    {path: '/student', name: 'student', component: () => import('@/views/student/List.vue')},
    {path: '/question', name: 'question', component: () => import('@/views/question/List.vue')},
    {path: '/notice', name: 'notice', component: () => import('@/views/notice/List.vue')},
    {path: '/exam-mock', name: 'exam-mock', component: () => import('@/views/exam-mock/List.vue')},
  ]
})
let timeoutId;
router.beforeEach((to, from) => {
  timeoutId = setTimeout(() => {
    NProgress.start();
  }, 500)
});

router.afterEach((to, from) => {
  timeoutId && clearTimeout(timeoutId)
  NProgress.done();

});

export default router
